clang-tidy modernize-loop-convert (#1275)
authortsteven4 <13596209+tsteven4@users.noreply.github.com>
Sat, 4 May 2024 17:53:36 +0000 (11:53 -0600)
committerGitHub <noreply@github.com>
Sat, 4 May 2024 17:53:36 +0000 (11:53 -0600)
duplicate.cc
shape.cc

index 552b23faf6d1c3b3c7e2b77965c4f017a487168a..32378b3193ade10fdcf4912f8e392fbe624bd9ad 100644 (file)
@@ -73,8 +73,7 @@ void DuplicateFilter::process()
         wptfirst->latitude = wptlast->latitude;
         wptfirst->longitude = wptlast->longitude;
       }
-      for (auto it = values.cbegin(); it != values.cend(); ++it) {
-        Waypoint* wpt = *it;
+      for (Waypoint* wpt : values) {
         if (purge_duplicates || (wpt != wptfirst)) {
           wpt->wpt_flags.marked_for_deletion = 1;
         }
index 42cbe1e57133ce2fe26bdd4264a10d07d94bf20e..19af063af49621cce504d066584719a2d681fa2d 100644 (file)
--- a/shape.cc
+++ b/shape.cc
@@ -220,15 +220,15 @@ ShapeFormat::read()
       nameidx = -2;
       const QStringList opt_name_fields = qopt_name.split('+', Qt::SkipEmptyParts);
       nameindices.reserve(opt_name_fields.size());
-      for (int oidx=0; oidx<opt_name_fields.size(); oidx++) {
+      for (const auto & opt_name_field : opt_name_fields) {
         bool ok;
-        int fieldIdx = opt_name_fields.at(oidx).toInt(&ok);
+        int fieldIdx = opt_name_field.toInt(&ok);
         if (ok) {
           // retrieve name component from given field number
           check_field_index(fieldIdx);
         } else {
           // retrieve name component from given field name.
-          fieldIdx = get_field_index(opt_name_fields.at(oidx));
+          fieldIdx = get_field_index(opt_name_field);
         }
         nameindices.append(fieldIdx);
       }